package com.guo.worktool.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
@AllArgsConstructor
public enum EnumSQLType {
    用户id("id","1"),
    用户name("name","2"),
    身份证号码idNo("idNo","3"),
    原生表单("from","4"),
    MAP("map","5"),
    JSON("json","6"),
    NULL("null","7");

    private final String key;
    private final String value;

    private static final Map<String, EnumSQLType> codeMap = new HashMap<>((int)(values().length / .75f) + 1);

    static {
        for (EnumSQLType item : values()) {
            codeMap.put(item.value, item);
        }
    }

    public static EnumSQLType fromCode(String code) {
        EnumSQLType item = codeMap.get(code);
        return item == null ? NULL : item;
    }
}
